package com.dongbei.baseproject.di

import android.content.Context
import com.dongbei.baseproject.http.ApiClient
import com.dongbei.baseproject.http.ApiService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object AppModule {

    @Singleton
    @Provides
    fun providesContext(@ApplicationContext appContext: Context): Context {
        return appContext
    }


    @Provides
    fun providesApiClient(): ApiClient = ApiClient.getInstance(null)

    @Singleton
    @Provides
    fun providesApiService(apiClient: ApiClient): ApiService {
        return apiClient.createApiService()
    }
}